package com.hyper_yang._03_designpatterns.principles.demo2.before;

/**
 * projectName: com.hyper_yang._03_designpatterns.principles.demo2.before
 *
 * @author: sakiko
 * time: 2025/9/26 0:35
 * description: 长方形案例 【依赖】 长方形类
 */
public class RectangleDemo {
    // 拓宽方法
    public static void resize(Rectangle rectangle) {
        // 判断宽如果比长小，进行拓宽的操作
        while (rectangle.getWidth() <= rectangle.getLength())
            rectangle.setWidth(rectangle.getWidth() + 1);
    }

    // 打印长和宽
    public static void printLengthAndWidth(Rectangle rectangle) {
        System.out.println("rectangle.l = " + rectangle.getLength());
        System.out.println("rectangle.w = " + rectangle.getWidth());
    }
}
